home *** CD-ROM | disk | FTP | other *** search
- Path: news.ichange.com!newsmaster
- From: Jesse Liberty <jl@staff.ichange.com>
- Newsgroups: comp.lang.c++
- Subject: Re: Please please help a newbie!
- Date: Thu, 15 Feb 1996 10:07:09 -0500
- Organization: AT&T
- Message-ID: <31234C1D.7712@staff.ichange.com>
- References: <4ftoe8$5a2@pacifica.access.ch> <31232DBE.5A69@staff.ichange.com> <31233ED0.5B2E@staff.ichange.com>
- NNTP-Posting-Host: 140.244.99.60
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b6a (Win95; I)
- CC: jl@staff.ichange.com
-
- Well,I'm having a heck of a time, neither my mailer nor my brain is
- working. The problem with your example was NOT what I said (of course
- you CAN declare the variables external to main -- whatever was I
- thinking), nor did my correction come through correctly due to the
- mailer screwing up.
-
- Let's try again.
-
- First, the original problem is that you have a .c extension on your file
- and your compiler is probably treating it as a c program and not a c++
- program. Thus it is complaining about your reference, which is not a
- construct that c understands. Try changing the file to .cpp.
-
- Second, there is no reason to make your int and int ref external to
- main, you probably mean to write:
-
-
- main()
- {
- int i;
- int & a=i;
- }
-
- In a c++ program, that will compile (thought it won't do much).
-
-
-
- --
- Jesse Liberty jl@staff.ichange.com
- AT&T CIS: 72241,72
-